#/usr/bin/python
#-*-<coding=UTF-8>-*-

"""
本例展示了如何给框架添加菜单栏，工具栏和状态栏
"""

import wx
#import images
from sketchWindow import SketchWindow 

class SketchApp(wx.App):
    def OnInit(self):
        bmp = wx.Image("splash.jpg").ConvertToBitmap()
        wx.SplashScreen(bmp,wx.SPLASH_CENTRE_ON_SCREEN|wx.SPLASH_TIMEOUT,5000,None,-1)
        wx.Yield()

        #frame = SketchWindow(None)
        #frame.Show()
        #self.SetTopWindow(frame)
        return True

class Frame(wx.Frame):
    
    def __init__(self):
	wx.Frame.__init__(self,parent=None,id=-1,title="Toolbars",pos=wx.DefaultPosition,size=wx.DefaultSize)
	#创建wx.panel对像的实例,并设置其背景为白色
	panel = wx.Panel(self)
	panel.SetBackgroundColour("White")

	#创建状态栏,不需要传入self参数吗? 或是panel参数?
	statusBar = self.CreateStatusBar()

	#创建工具栏,问题同上?
	toolbar = self.CreateToolBar()
	bmp_new = wx.ArtProvider.GetBitmap(wx.ART_NEW,wx.ART_TOOLBAR)
	toolbar.AddSimpleTool(wx.NewId(),bmp_new,"New","Long help for 'New'")
	toolbar.Realize()
	
	#创建菜单栏
	menuBar = wx.MenuBar()
	
	#创建File菜单项,这些是要放到菜单栏上的
	menu1 = wx.Menu()
	menuBar.Append(menu1,"&File")

	#创建Edit菜单项
	menu2 = wx.Menu()
	menu2.Append(wx.NewId(),"&Copy","Copy in status bar")
	menu2.Append(wx.NewId(),"C&ut","")
	menu2.Append(wx.NewId(),"Paste","")
	#创建一个分隔符
	menu2.AppendSeparator()
	menu2.Append(wx.NewId(),"&Options...","Display Options")
	menuBar.Append(menu2,"&Edit")

	self.SetMenuBar(menuBar)

if __name__ == "__main__":
    #app = wx.PySimpleApp()
    app = SketchApp()
    frame = Frame()
    frame.Show()
    app.MainLoop()
